package org.pwwong.scalautils.time

abstract class Duration(val durationValue:Long){
  def to_ns:Long
  def to_ms:Long
  def to_sec:Long
  def to_min:Long
  def to_hour:Long
  
  final def ns = Nanoseconds(durationValue)
  final def ms = Milliseconds(durationValue)
  final def secs = Seconds(durationValue)
  final def mins = Minutes(durationValue)
  final def hours = Hours(durationValue)
}
case class Nanoseconds(_dv:Long) extends Duration(_dv){
  override def to_ns = durationValue
  override def to_ms = to_ns/1000000
  override def to_sec = to_ms/1000
  override def to_min= to_sec/60
  override def to_hour= to_min/60
} 
case class Milliseconds(_dv:Long) extends Duration(_dv){
  override def to_ns = to_ms*1000000
  override def to_ms = durationValue
  override def to_sec = to_ms/1000
  override def to_min = to_sec/60
  override def to_hour= to_min/60
} 
case class Seconds(_dv:Long) extends Duration(_dv){
  override def to_ns = to_ms*1000000
  override def to_ms = to_sec*1000
  override def to_sec = durationValue
  override def to_min= to_sec/60
  override def to_hour= to_min/60
} 
case class Minutes(_dv:Long) extends Duration(_dv){
  override def to_ns = to_ms*1000000
  override def to_ms = to_sec*1000
  override def to_sec = to_min*60
  override def to_min= durationValue
  override def to_hour= to_min/60
} 
case class Hours(_dv:Long) extends Duration(_dv){
  override def to_ns = to_ms*1000000
  override def to_ms = to_sec*1000
  override def to_sec = to_min*60
  override def to_min= to_hour*60
  override def to_hour= durationValue
} 
  